<!doctype html>
<html lang="en">

	<head>
		<meta charset="UTF-8" />
		<title>设置姓名</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
		<style>
			.whole {
				margin-top: 15px;
				width: 100%;
				background: #ffffff !important;
			}
			
			#sub {
				margin: 30px 0;
				width: 100%;
			}
			
			.change {
				margin: 0;
			}
		</style>
	</head>

	<body>

		<header class="mui-bar mui-bar-nav">
			<a href="javascript:history.go(-1)" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">设置姓名</h1>
		</header>

		<!--更改姓名-->
		<div class="mui-content id">
			<div class="whole">
				<form class="mui-input-group" action="1">
					<div class="mui-input-row">
						<label class="name pwd">原名称</label>
						<input type="input" class="mui-input-clear" disabled="disabled" value="MyAngels">
					</div>

					<div class="mui-input-row">
						<label class="name">更改为</label>
						<input type="text" class="mui-input-clear" id="code" placeholder="请输入新名称">
					</div>
					<div class="change">
						<button type="button" id="sub" class="mui-btn mui-btn-blue">修改</button>
					</div>
				</form>
			</div>
		</div>

		<script src="js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init()
			
			/*验证新用户名是否为空、6-10用户名*/
			var codec = document.getElementById('code');
			var sub = document.getElementById('sub');
			sub.onclick = function(){
				var check = true;
				var reg = /^[a-zA-Z]{6,10}$/;
				var cc = codec.value;
				if(cc == ''){
					mui.toast('用户名不能为空');
					check = false;
			    	return false;
				}
				if(!reg.test(cc)){
					mui.toast('请输入6-10个英文用户名');
					check = false;
			    	return false;
				}
				if(check){
					$('form').submit()
				}
			}
		</script>
	</body>

</html>